﻿using System.Data;
using DevExpress.XtraEditors;

namespace Mota.XMLControls
{
    /// <summary>
    /// Represent Label control based on DX LabelControl 
    /// </summary>
    public class DXGuiLabel:GuiLabel
    {
        public DXGuiLabel()
        {
            visualControl = new LabelControl();
        }
        /// <summary>
        /// Set Text value for DX Label Control
        /// </summary>
        public override string Text
        {
            get
            {
                return (visualControl as LabelControl).Text;
            }
            set
            {
                (visualControl as LabelControl).Text = value;
            }
        }
        /// <summary>
        /// Add databinding on DX LabelControl Text property 
        /// </summary>
        /// <param name="valueBinding">main binding with current object values</param>
        public override void SetValue(object valueBinding)
        {
            (visualControl as LabelControl).DataBindings.Add("Text", valueBinding as System.Windows.Forms.BindingSource, XmlAttributes["XMLAttribute"], true);
        }
        /// <summary>
        /// Dummy Binding for current control 
        /// getter allways return null value
        /// </summary>
        public override object Binding
        {
            get
            {
                return null;
            }
            set
            {
                //throw new System.NotImplementedException();
            }
        }

        public override object GetValue()
        {
            return (visualControl as LabelControl).Text;
        }
    }
}
